home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / pump_src / dpmidvt.h < prev    next >
C/C++ Source or Header  |  1995-10-26  |  5KB  |  128 lines

  1. /* ------------------------ DPMIDVT.H --------------------------- */
  2. /* DPMI interface code to DemoVT v1.5 and higher.                 */
  3. /* Written bye Jare of Iguana in 1994.                            */
  4. /* -------------------------------------------------------------- */
  5. /* Thanks to Yann for supplying all those specs, and also to Tran */
  6. /* of nothing for getting me into this wonderful world of PMode.  */
  7. /* -------------------------------------------------------------- */
  8. /* This code will compile under Watcom C++ 9.5. I think it should */
  9. /* work also with other versions and under other 32 bit compilers */
  10. /* but I haven't bothered to test.                                */
  11. /* -------------------------------------------------------------- */
  12. /* You will find some general purpose DPMI code here. Use it!     */
  13. /* Especially that RealModeMem variable.                          */
  14. /* That variable is not necessary under DOS4GW, because the first */
  15. /* megabyte is directly accesible using the default data seg. But */
  16. /* I have included it to make this code fully portable to other,  */
  17. /* more hostile environments.                                     */
  18. /* You might need to translate it to assembly, but that should be */
  19. /* easy. After all, it's your job! :)                             */
  20. /* -------------------------------------------------------------- */
  21.  
  22. #ifndef _DPMIDVT_H_
  23. #define _DPMIDVT_H_
  24.  
  25. // ------------------------------------------------------------------------
  26. // ---------- DemoVT. The real thing.
  27.  
  28. #pragma pack(1)
  29.  
  30. typedef struct {
  31.     word  period;             // Period of the playing note.
  32.     byte  ins;                // Number of instrument, 1-31.
  33.     byte  vol;                // Current volume, 0-63.
  34. } TChanData;
  35.  
  36. typedef struct sDVT_info {    // DemoVT's info structure.
  37.         // Written by DemoVT.
  38.     byte  semaphores   [256]; // 256 semaphores used for synchronisation.
  39.     byte  chansTrig    [32];  // Flags that indicate note triggered for
  40.                               //  each channel. Useful for vu-meters.
  41.     byte  numChannels;        // Number of channels of the current module.
  42.     word  entryPointOff,      // Far pointer to the servicing routine
  43.           entryPointSeg;      //  that receives params thru the stack.
  44.     dword tickCounter;        // 50 Hz counter. Increments 50 times per second.
  45.     word  entryPointAXOff,    // Far pointer to the servicing routine
  46.           entryPointAXSeg;    //  that gets the parameter in AX. It's just
  47.                               //  a PUSH AX; CALL FAR entryPointSeg:Off; RETF
  48.  
  49.     TChanData chansData[32];  // Info about all playing channels.
  50.  
  51.     byte  pos;                // Position of the current note in the pattern.
  52.     byte  seq;                // Order number of playing pattern.
  53.  
  54.     byte  _reserved2   [81];
  55.  
  56.         // Read and written by DemoVT.
  57.     byte  _reserved3   [3];
  58.     byte  jumpNewPos,         // Boolean. 1 if song must jump.
  59.           jumpPosSeq,         // Sequence and note values to jump to.
  60.           jumpPosNote;
  61.     byte  soundVolume;        // Volume of the sound output.
  62.     byte  abortDvt;           // Set to 1 to abort the demo.
  63.     byte  _reserved4   [248];
  64. } TDVTInfo;
  65.  
  66. #pragma pack()
  67.  
  68. extern byte      _far *RealModeMem;     // This gives access to the 1st. Meg.
  69. extern dword           DVTAppIdFound;   // Offset into RealModeMem of the
  70.                                         // DemoVT data returned.
  71. extern volatile TDVTInfo  _far *DVTInfo;         // Pointer to the info structure.
  72.                                         // If DVT_Init fails, all these
  73.                                         // will be 0/NULL.
  74.  
  75.  
  76.    // DemoVT access functions.
  77.  
  78. extern int   DVT_Init(void);
  79.   //         --------
  80.   // Starts the interface variables, and returns if the DemoVT is present.
  81.   // NOTE: check for DVTInfo != NULL even if the DemoVT is present, the
  82.   // DPMI interface might fail (nobody's perfect).
  83.  
  84. extern void  DVT_CallDemoVT(int command);
  85.   //         --------------
  86.   // Calls DemoVT API entry point.
  87.  
  88. #define      DVT_CallMusic()       DVT_CallDemoVT(2)
  89.   //         -------------
  90.  
  91. #define      DVT_ConnectTimer()    DVT_CallDemoVT(0)
  92.   //         ----------------
  93.  
  94. #define      DVT_DisconnectTimer() DVT_CallDemoVT(1)
  95.   //         -------------------
  96.  
  97. #define      DVT_BeginSync()       DVT_CallDemoVT(3)
  98.   //         -------------
  99.  
  100. extern dword DVT_GetTickCounter(void);
  101.   //         ------------------
  102.  
  103. extern void  DVT_WaitForStart(void);
  104.   //         ----------------
  105.  
  106. extern void  DVT_JumpPos(byte pattern, byte note);
  107.   //         -----------
  108.  
  109. extern byte  DVT_GetSemaphore(byte nsem);
  110.   //         ----------------
  111.  
  112. extern void  DVT_SetSemaphore(byte nsem, byte value);
  113.   //         ----------------
  114.  
  115. extern void  DVT_MiddleSync(byte nsem, byte pattern, byte note);
  116.   //         --------------
  117.  
  118. extern byte  DVT_GetSoundVolume(void);
  119.   //         ------------------
  120.  
  121. extern void  DVT_SetSoundVolume(byte vol);
  122.   //         ------------------
  123.  
  124. #endif
  125.  
  126. /* ------------------------ DPMIDVT.H --------------------------- */
  127.  
  128.